package com.yitiao.designmodel.behave.observer;

import java.util.ArrayList;
import java.util.List;

public class YitiaoBlogger extends Bloggers{
    List<Fans> fans = new ArrayList<>();

    public void startLive(){
        System.out.println("startLive....");
        notifyFans("startLive");
    }

    public void endLive(){
        System.out.println("endLive....");
        notifyFans("endLive");
    }

    @Override
    public void notifyFans(String msg) {
        for (Fans fan : fans) {
            fan.handlePublish(msg);
        }
    }

    @Override
    public void addFans(Fans fans) {
       this.fans.add(fans);
    }
}
